/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

import { TCB } from '../model/tcb.js';

/**
 * TCB存储
 * 维护TCB数据
 *
 * @since 2022/8/16
 */
export class TcbStore {
  private static tcbMap: Map<string, TCB> = new Map();

  static getTCB(id: string): TCB | undefined {
    return TcbStore.tcbMap.get(id);
  }

  static clear(): void {
    TcbStore.tcbMap.clear();
  }

  static add(tcb: TCB): void {
    TcbStore.tcbMap.set(tcb.getId(), tcb);
  }
}
